<template>
  <div class="container">
    <div class="left" :style="{ width: isCollapse ? '50px' : '200px' }">
      <div class="collapse-btn" @click="toggleCollapse">
        <i class="el-icon-s-fold" v-if="!isCollapse"></i>
        <i class="el-icon-s-unfold" v-else></i>
      </div>
      <!-- 左侧列表 -->
    </div>
    <div class="right">
      <!-- 右侧内容 -->

      <div class="right-part">
        <div>123</div>
        <div>123</div>
        <div>123</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isCollapse: false // 初始状态为不收缩
    }
  },
  methods: {
    toggleCollapse() {
      this.isCollapse = !this.isCollapse;
    }
  }
}
</script>

<style scoped>
.container {
  display: flex;
  height: 80vh;
  
}

.left {
  position: relative;
  transition: width 0.3s ease; /* 添加过渡效果 */
  background-color: red;
}

.right {
  flex: 1;
  background-color: aqua;
}

.collapse-btn {
  position: absolute;
  top: 0;
  right: 0;
  padding: 10px;
  cursor: pointer;
}
.right-part {
  display: flex;
}
</style>
